#!/bin/bash
if [ "$1" == "" ]; then 
 STORE=/etc/alsactl.store
else
 STORE=$1
fi

alsactl -f $STORE restore

. /etc/hifiberry.state
DSP=`echo $CURRENT_FEATURES | grep -i dsp`
if [ "$DSP" != "" ]; then
 dsptoolkit --timeout=5 set-volume `cat /etc/dspvolume.store`
fi

if [ "$CURRENT_MIXER_CONTROL" != "Softvol" ]; then
 if [ -f "/etc/softvol.limit" ]; then 
  amixer sset Softvol `cat /etc/softvol.limit`
 else
  amixer sset Softvol 100%
 fi
fi

if [ -f /opt/hifiberry/bin/fix-dacadcpro-mixer ]; then
 /opt/hifiberry/bin/fix-dacadcpro-mixer
fi
